package com.dingding.gmall.ware.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.dingding.gmall.common.dto.mq.order.OrderInfoDTO;
import com.dingding.gmall.common.dto.mq.ware.StockLockedSuccessDTO;
import com.dingding.gmall.common.utils.PageUtils;
import com.dingding.gmall.ware.dto.WareSkuLockDTO;
import com.dingding.gmall.ware.entity.WareSkuEntity;
import com.dingding.gmall.ware.vo.SkuHasStockVO;

import java.util.List;
import java.util.Map;

/**
 * 商品库存
 *
 * @author liudingding
 * @email sunlightcs@gmail.com
 * @date 2020-07-02 22:56:09
 */
public interface WareSkuService extends IService<WareSkuEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 查看是否有库存
     * @param skuIds
     * @return
     */
    List<SkuHasStockVO> getSkusHasStock(List<Long> skuIds);

    /**
     * 为订单锁库存
     * @param wareSkuLockDTO
     * @return
     */
    boolean orderLockStock(WareSkuLockDTO wareSkuLockDTO);

    void unlockStock(StockLockedSuccessDTO dto);

    void unlockStock(OrderInfoDTO dto);
}

